<?php
/**
 * @Copyright Copyright (C) 2010-2012
 * @license GNU/GPL http://www.gnu.org/copyleft/gpl.html
 + Created by:          Webit Solution
 * Company:		Webit Solution
 + Contact:		www.webits.asia, developer@webits.asia
 * Created on:	Mar 21, 2012
 ^
 + Project: 		WRecruit
 * File Name:	views/employer/tmpl/mycompanies.php
 ^ 
 * Description: template view for my companies
 ^ 
 * History:		NONE
 ^ 
 */
 
 defined('_JEXEC') or die('Restricted access');
 
 global $mainframe;
 $link = 'index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=my_stats&Itemid='.$this->Itemid;
  $document =& JFactory::getDocument();
   $document->addStyleSheet('components/com_wrecruit/css/'.$this->config['theme']);
?>

<?php if ($this->config['offline'] == '1'){ ?>
<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	<?php echo $this->config['title']; ?></td></tr>
	<tr><td height="25"></td></tr>
	<tr><td class="wrecruitmsg">
		<?php echo $this->config['offline_text']; ?>
	</td></tr>
</table>	
<?php }else{ ?>

<table cellpadding="0" cellspacing="0" border="0" width="100%" >
	<tr><td valign="top" class="<?php echo $this->theme['title']; ?>" >	
		<?php echo $this->config['title']; ?>
	</td>
	</tr>
	<tr><td height="23"></td></tr>
	<?php if ($this->config['cur_location'] == 1) {?>
	<tr><td height="0"></td></tr>
	<tr><td class="curloc">
		<?php echo JText::_('JS_CUR_LOC'); ?> : <?php echo JText::_('JS_MY_STATS'); ?>
	</td></tr>
	<?php } ?>
	<tr><td>
		<?php 
			$cutomlink = 'index.php?option=com_wrecruit&c=wrecruit&view=employer&layout=formcompany&Itemid='.$this->Itemid;
			$cutomlinktext = JText::_('JS_NEW_COMPANY');
			$count = 0;
			if (sizeof($this->employerlinks) != 0){
				echo '<div id="toplinks"><ul>';
				
				foreach($this->employerlinks as $lnk)	{ ?>
					<span <?php if($lnk[2] == 1)echo 'class="first"'; elseif($lnk[2] == -1)echo 'class="last"';  ?>>
						<a href="<?php echo $lnk[0]; ?>"> <?php echo $lnk[1]; ?></a>	
					</span>
				<?php $count++;	
				}
				echo '<ul></div>';	
				
			} 
		?>
	</td></tr>	
	<tr><td height="3"></td></tr>
	<tr><td class="<?php echo $this->theme['heading']; ?>" align="center">
		<?php echo JText::_('JS_MY_STATS'); ?>
	</td></tr>
	<tr><td height="3"></td></tr>
</table>


<?php
if ($this->userrole->rolefor == 1) { // employer
    $isodd =1;
    $tdclass = array($this->theme['odd'], $this->theme['even']);
?>

	<table cellpadding="0" cellspacing="0" border="0" width="100%" >
		<tr  class="<?php echo $this->theme['sortlinks']; ?>" valign="middle">
                    <td  width="25%" ><strong></strong></td>
                    <td  width="25%" align="center"><strong><?php echo JText::_('JS_CURRENT_ALLOW'); ?></strong></td>
                    <td width="25%" align="center"><strong><?php echo JText::_('JS_TOTAL'); ?></strong></td>
                    <td width="25%" align="center"><strong><?php echo JText::_('%'); ?></strong></td>
                </tr>
                <?php $isodd = 1 - $isodd; ?>
                <tr class="<?php echo $tdclass[$isodd]; ?>">
                    <td><strong><?php echo JText::_('JS_COMPANIES'); ?></strong></td>
                    <td align="center"><?php if($this->companiesallow== -1) echo JText::_('JS_UNLIMITED');echo $this->companiesallow; ?></td>
                    <td align="center"><?php echo $this->totalcompanies; ?></td>
                    <td align="center"><?php $output = '-'; if($this->companiesallow!= -1) if ($this->totalcompanies <= $this->companiesallow) if($this->companiesallow != 0) $output = round(($this->totalcompanies/$this->companiesallow)*100) .' %' ; echo $output; ?></td>
		</tr>
                <?php $isodd = 1 - $isodd; ?>
                <tr class="<?php echo $tdclass[$isodd]; ?>">
                    <td><strong><?php echo JText::_('JS_JOBS'); ?></strong></td>
                    <td align="center"><?php if($this->jobsallow == -1) echo JText::_('JS_UNLIMITED');else echo $this->jobsallow; ?></td>
                    <td align="center"><?php echo $this->totaljobs; ?></td>
                    <td align="center"><?php $output = '-'; if($this->jobsallow!= -1) if ($this->totaljobs <= $this->jobsallow) if($this->jobsallow != 0) $output = round(($this->totaljobs/$this->jobsallow)*100) .' %' ; echo $output; ?></td>
		</tr>
                <?php $isodd = 1 - $isodd; ?>
                <tr class="<?php echo $tdclass[$isodd]; ?>">
                    <td><strong><?php echo JText::_('JS_GOLD_COMPANIES'); ?></strong></td>
                    <td align="center"><?php if($this->goldcompaniesallow== -1) echo JText::_('JS_UNLIMITED');else echo $this->goldcompaniesallow; ?></td>
                    <td align="center"><?php echo $this->totalgoldcompanies; ?></td>
                    <td align="center"><?php $output = '-'; if($this->goldcompaniesallow!= -1) if ($this->totalgoldcompanies <= $this->goldcompaniesallow) if($this->goldcompaniesallow != 0) $output = round(($this->totalgoldcompanies/$this->goldcompaniesallow)*100) .' %' ; echo $output; ?></td>
		</tr>
                <?php $isodd = 1 - $isodd; ?>
                <tr class="<?php echo $tdclass[$isodd]; ?>">
                    <td><strong><?php echo JText::_('JS_FEATURED_COMPANIES'); ?></strong></td>
                    <td align="center"><?php if($this->featuredcompainesallow== -1) echo JText::_('JS_UNLIMITED');else echo $this->featuredcompainesallow; ?></td>
                    <td align="center"><?php echo $this->totalfeaturedcompanies; ?></td>
                    <td align="center"><?php $output = '-'; if($this->featuredcompainesallow!= -1) if ($this->totalfeaturedcompanies <= $this->featuredcompainesallow) if($this->featuredcompainesallow != 0) $output = round(($this->totalfeaturedcompanies/$this->featuredcompainesallow)*100) .' %' ; echo $output; ?></td>
		</tr>
                <?php $isodd = 1 - $isodd; ?>
                <tr class="<?php echo $tdclass[$isodd]; ?>">
                    <td><strong><?php echo JText::_('JS_GOLD_JOBS'); ?></strong></td>
                    <td align="center"><?php if($this->goldjobsallow== -1) echo JText::_('JS_UNLIMITED');else echo $this->goldjobsallow; ?></td>
                    <td align="center"><?php echo $this->totalgoldjobs; ?></td>
                    <td align="center"><?php $output = '-'; if($this->goldjobsallow!= -1) if ($this->totalgoldjobs <= $this->goldjobsallow) if($this->goldjobsallow != 0) $output = round(($this->totalgoldjobs/$this->goldjobsallow)*100) .' %' ; echo $output; ?></td>
		</tr>
                <?php $isodd = 1 - $isodd; ?>
                <tr class="<?php echo $tdclass[$isodd]; ?>">
                    <td><strong><?php echo JText::_('JS_FEATURED_JOBS'); ?></strong></td>
                    <td align="center"><?php if($this->featuredjobsallow== -1) echo JText::_('JS_UNLIMITED');else echo $this->featuredjobsallow; ?></td>
                    <td align="center"><?php echo $this->totalfeaturedjobs; ?></td>
                    <td align="center"><?php $output = '-'; if($this->featuredjobsallow!= -1) if ($this->totalfeaturedjobs <= $this->featuredjobsallow) if($this->featuredjobsallow != 0) $output = round(($this->totalfeaturedjobs/$this->featuredjobsallow)*100) .' %' ; echo $output; ?></td>
		</tr>
	</table>
			

<?php


} else{ // not allowed job posting
echo JText::_('JS_YOU_ARE_NOT_ALLOWED_TO_VIEW');
}	
}//ol
?>	
<div width="100%">
<?php 
if($this->config['fr_cr_txsh']) {
	echo 
	'<table width="100%" style="table-layout:fixed;">
		<tr><td height="15"></td></tr>
		<tr><td style="vertical-align:top;" align="center">'.$this->config['fr_cr_txa'].$this->config['fr_cr_txb'].'</td></tr>
	</table>';
}	
?>
</div>


